package com.example.rekooh.plugin;

import android.util.Log;
import android.widget.Button;

import com.example.rekooh.JavaTweakBridge;

public class hookDemo {

    private static final String TAG = "JavaTweak";
    static boolean hooked = false;

    static public void defineJavaClass(Class<?> clazz) {

        if(clazz.getName().equals("com.example.justextends.MainActivity")){
            if (!hooked) {
                hooked = true;
                //JavaTweakBridge.hookJavaMethod(clazz.getClassLoader(), "com.example.justextends.MainActivity", "onResume");
                JavaTweakBridge.hookJavaMethod(clazz.getClassLoader(), "com.example.justextends.MainActivity", "getValue");
            }
        }else if(clazz.getName().equals("android.app.IWindowToken")){
            //JavaTweakBridge.hookJavaMethod("com.example.justextends.MainActivity", "getValue");

        }
    }

    static private void onResume(Object thiz) {
        Log.i(TAG, "AAAAAAAAAAA");
        JavaTweakBridge.callOriginalMethod(thiz);
    }


    static private String getValue(Object thiz) {
        Log.i(TAG, "bf changeView");
        JavaTweakBridge.callOriginalMethod(thiz);
        return "change";
    }
}
